package com.shinhye.demoproject;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;

import com.shinhye.demoproject.util.KeyboardUtil;

public class KeyBoardActivity extends AppCompatActivity {

    private EditText edit2;
    private EditText edit1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_key_board);

        edit1 = (EditText) findViewById(R.id.editText1);
        edit2 = (EditText) findViewById(R.id.editText2);

        edit1.setInputType(InputType.TYPE_NULL);

        edit1.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                new KeyboardUtil(KeyBoardActivity.this, KeyBoardActivity.this, edit1).showKeyboard();
                return false;
            }
        });

        edit2.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                int inputback = edit2.getInputType();
                edit2.setInputType(InputType.TYPE_NULL);
                new KeyboardUtil(KeyBoardActivity.this, KeyBoardActivity.this, edit2).showKeyboard();
                edit2.setInputType(inputback);
                return false;
            }
        });
    }
}
